package adv8;

import java.beans.XMLDecoder;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.List;

public class XMLToObj {

	public static void main(String[] args) throws IOException {
		// xml读取成对象
		XMLDecoder xd = new XMLDecoder(new FileInputStream("guazi.xml"));
		List<Product> list = (List<Product>) xd.readObject();
		xd.close();
		for (Product p : list)
			System.out.println(p.getItemno() + "," + p.getName());
	}

}
